<template>
    <div>
        <BreadCrumb></BreadCrumb>
        <div>
            <div>姓名:{{student.name}}</div>
            <div>年龄:{{student.age}}</div>
            <div>性别:{{student.gender}}</div>
            <div>
                <img :src="student.image" class="avatar">
            </div>
            <div>
                所属专业:{{student.subjectsId?student.subjectsId.name:'暂无专业'}}
            </div>
            <div>
                所属班级:{{student.classesId?student.classesId.name:"暂无班级"}}
            </div>
        </div>
    </div>
</template>

<script>
import BreadCrumb from '@/components/BreadCrumb.vue'
export default {
    components:{BreadCrumb},
    data(){
        return{
            student:{}
        }
    },
    methods:{
        async getStudentsById(_id){
            let result=await this.$api.students.getStudentsById(_id)
            console.log(result.data);
            this.student=result.data
        },
        back(){
            this.$router.back()
        }
    },
    created(){
       this.getStudentsById(this.$route.query._id)
    }
}
</script>

<style>
    .avatar{
        width: 100px;
        height: 100px;
    }
</style>